package com.nota.flink.cdc.pojo.enums;

import lombok.Getter;

@Getter
public enum ResultCode {

    OK(200, "ok"),

    FAIL(500, "fail"),

    REQUIRE(400, "paras require"),

    UNAUTHORIZED(401, "please login"),

    unauthorized(401, "please login");

    private final Integer code;

    private final String msg;


    ResultCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ResultCode getResult(int code) {
        ResultCode[] rcs = ResultCode.values();
        for (ResultCode rc : rcs) {
            if (rc.getCode() == code) {
                return rc;
            }
        }
        return null;
    }
}
